﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Data.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class DatabaseConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:database";

        const string DATASOURCE_FACTORY_TYPE = "dataSourceFactoryType";
        const string CONNECTIONS = "connections";
        const string PROVIDERS = "providers";
        const string COMMANDS = "commands";
        /// <summary>
        /// 
        /// </summary>
        public DatabaseConfiguration()
        {
            this.DataSourceFactoryType = typeof(DataSourceFactory).AssemblyQualifiedName;
        }
        /// <summary>
        /// 数据源工厂类型定义
        /// </summary>
        [ConfigurationKeyName(DATASOURCE_FACTORY_TYPE)]
        public string DataSourceFactoryType
        {
            get;
            set;
        }
        /// <summary>
        /// 连接配置集
        /// </summary>
        [ConfigurationKeyName(CONNECTIONS)]
        public ConnectionConfigurationCollection Connections
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName(PROVIDERS)]
        public ProviderSettingsCollection ProviderSettings
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName(COMMANDS)]
        public CommandConfigurationCollection Commands
        {
            get;
            set;
        }
    }
}
